/*
 * Copyright (C) 2011 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.google.codemirror2_gwt.client;

/**
 * Determines what happens when the user presses the tab key.
 *
 * @author Nikhil Singhal
 */
public enum TabMode {
  /**
   * When nothing is selected, insert a tab. Otherwise, behave like the "shift" mode.
   * (When shift is held, this behaves like the "indent" mode.) This is the default.
   */
  CLASSIC("classic"),
  /**
   * Indent all selected lines by one indentUnit. If shift was held while pressing tab, un-indent
   * all selected lines one unit.
   */
  SHIFT("shift"),
  /**
   * Indent the line the 'correctly', based on its syntactic context. Only works if the mode
   * supports it.
   */
  INDENT("indent"),
  /**
   * Do not capture tab presses, let the browser apply its default behaviour (which usually means
   * it skips to the next control).
   */
  DEFAULT("default");

  private final String name;

  private TabMode(String name) {
    this.name = name;
  }

  @Override
  public String toString() {
    return name;
  }
}
